//
//  HomePublicChoosePhotoCollectionViewCell.m
//  ZJControlsClass
//
//  Created by mac on 2024/12/5.
//

#import "HomePublicChoosePhotoCollectionViewCell.h"

@implementation HomePublicChoosePhotoCollectionViewCell



- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if(self){
        
        
        [self addSubview:self.img];
        [self.img addSubview:self.Addimg];
        [self addSubview:self.canleBtn];
        
        
        [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.right.bottom.equalTo(self);
        }];
        
        [self.Addimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.img.mas_centerX);
            make.centerY.equalTo(self.img.mas_centerY);
            make.size.equalTo(@(CGSizeMake(ALIGN_WIDTH_PT(30), ALIGN_WIDTH_PT(30))));
        }];
        
        [self.canleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.img.mas_right);
            make.top.equalTo(self.img.mas_top);
            make.size.equalTo(@(CGSizeMake(ALIGN_WIDTH_PT(20), ALIGN_WIDTH_PT(20))));
        }];
        
        
        
    }
    return self;
}



-(void)respondsTo_canleBtn:(UIButton *)sender{
    !_dispachCanleBtn ?: _dispachCanleBtn();
}



#pragma mark -- 懒加载
-(UIImageView *)img{
    if (!_img){
        _img = [UIImageView new];
        _img.layer.cornerRadius = 10;
        _img.layer.masksToBounds = YES;
        [_img setContentScaleFactor:[UIScreen mainScreen].scale];
        _img.contentMode = UIViewContentModeScaleAspectFill;
        _img.autoresizingMask = UIViewAutoresizingNone;
        _img.backgroundColor = COLOR_RGB(241, 241, 241);
        _img.userInteractionEnabled = YES;
    }
    return _img;
}

-(UIImageView *)Addimg{
    if (!_Addimg){
        _Addimg = [UIImageView new];
    }
    return _Addimg;
}


-(UIButton *)canleBtn{
    if (!_canleBtn){
        _canleBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        [_canleBtn setImage:[UIImage imageNamed:@"icon_shanchu_yuan"] forState:(UIControlStateNormal)];
        [_canleBtn addTarget:self action:@selector(respondsTo_canleBtn:) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _canleBtn;
}








@end
